package com.manager.cms.service.impl;

import com.github.pagehelper.PageHelper;
import com.manager.cms.bo.UserInfo;
import com.manager.cms.common.Pageable;
import com.manager.cms.mapper.UserInfoMapper;
import com.manager.cms.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *
 * @author 
 * @version v1.0
 * @date 2020-05-19
 */
@Service
public class UserInfoServiceImpl implements UserInfoService {

    @Autowired
    private UserInfoMapper userInfoMapper;

    @Override
    public void insert(UserInfo record) {
        userInfoMapper.insert(record);
    }

    @Override
    public void update(UserInfo record){
        userInfoMapper.update(record);
    }

    @Override
    public void del(String id){
        userInfoMapper.del(id);
    }

    @Override
    public UserInfo selectByPrimaryKey(String id){
        return userInfoMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<UserInfo> getList(UserInfo record){
        return userInfoMapper.selectByRecord(record);
    }

    @Override
    public Pageable<UserInfo> pageList(UserInfo record, Integer pageNum, Integer pageSize){
        Integer count = userInfoMapper.countByRecord(record);
        PageHelper.startPage(pageNum, pageSize);
        List<UserInfo> list = userInfoMapper.selectByRecord(record);
        return new Pageable<>(list, count, pageSize, pageNum);
    }

}